package jnpf.controller;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jnpf.base.ActionResult;
import jnpf.base.UserInfo;
import jnpf.base.entity.VisualdevEntity;
import jnpf.base.service.VisualdevService;
import jnpf.base.util.DynDicUtil;
import jnpf.base.util.VisualUtils;
import jnpf.base.vo.PageListVO;
import jnpf.base.vo.PaginationVO;
import jnpf.engine.entity.FlowTaskEntity;
import jnpf.engine.enums.FlowStatusEnum;
import jnpf.engine.service.FlowTaskService;
import jnpf.entity.*;
import jnpf.exception.DataException;
import jnpf.exception.WorkFlowException;
import jnpf.generater.util.GeneraterSwapUtil;
import jnpf.model.zxgl_renwufankui.ZXGL_RenWuFanKuiInfoVO;
import jnpf.model.zxgl_xiangmufankui.*;
import jnpf.service.*;
import jnpf.util.JsonUtil;
import jnpf.util.RandomUtil;
import jnpf.util.UserProvider;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.io.IOException;
import java.util.Date;
import java.util.List;


/**
 * ZXGL_XiangMuFanKui
 *
 * @版本： V2.0
 * @版权： 河北交投智能交通技术有限责任公司
 * @作者： 数字交投项目组
 * @日期： 2025-03-19
 */
@Slf4j
@RestController
@Api(tags = "项目反馈", value = "zxgl")
@RequestMapping("/ZXGL_XiangMuFanKui")
public class ZXGL_XiangMuFanKuiController {


    @Autowired
    private DynDicUtil dynDicUtil;

    @Autowired
    private GeneraterSwapUtil generaterSwapUtil;

    @Autowired
    private UserProvider userProvider;

    @Autowired
    private VisualdevService visualdevService;

    @Autowired
    private FlowTaskService flowTaskService;

    @Autowired
    private ZXGL_XiangMuFanKuiService zXGL_XiangMuFanKuiService;

    @Autowired
    private ZXGL_XiangMuFanKui_JiaoFuwuService zXGL_XiangMuFanKui_JiaoFuwuService;

    @Autowired
    private ZXGL_XiangMuFanKui_RenWuService zXGL_XiangMuFanKui_RenWuService;

    @Autowired
    private ZXGL_RenWuFanKuiService zxglRenWuFanKuiService;

    @Autowired
    private ZXGL_XiangMuLiXiang_MingXiService zxglXiangMuLiXiangMingXiService;

    @Autowired
    private ZXGL_XieBanXiangMuFanKuiMXService zxglXieBanXiangMuFanKuiMXService;

    /**
     * 列表
     *
     * @param zXGL_XiangMuFanKuiPagination
     * @return
     */
    @ApiOperation("项目反馈分页")
    @PostMapping("/getList")
    public ActionResult list(@RequestBody ZXGL_XiangMuFanKuiPagination zXGL_XiangMuFanKuiPagination) throws IOException {
        List<ZXGL_XiangMuFanKuiEntity> list = zXGL_XiangMuFanKuiService.getList(zXGL_XiangMuFanKuiPagination);
        //处理id字段转名称，若无需转或者为空可删除
        for (ZXGL_XiangMuFanKuiEntity entity : list) {
            entity.setFkr(generaterSwapUtil.userSelectValues(entity.getFkr()));
            entity.setFkrbm(generaterSwapUtil.comSelectValues(entity.getFkrbm()));
            entity.setXmly(dynDicUtil.getDicName(entity.getXmly(), "667353988936504645"));
            entity.setXmlx(dynDicUtil.getDicName(entity.getXmlx(), "667277254828496197"));
            entity.setZrr(generaterSwapUtil.userSelectValues(entity.getZrr()));
            entity.setZrbm(generaterSwapUtil.comSelectValues(entity.getZrbm()));
            entity.setXzr(generaterSwapUtil.userSelectValues(entity.getXzr()));
            entity.setXzbm(generaterSwapUtil.comSelectValues(entity.getXzbm()));
        }
        List<ZXGL_XiangMuFanKuiListVO> listVO = JsonUtil.getJsonToList(list, ZXGL_XiangMuFanKuiListVO.class);
        for (ZXGL_XiangMuFanKuiListVO zXGL_XiangMuFanKuiVO : listVO) {
        }


        for (ZXGL_XiangMuFanKuiListVO vo : listVO) {
            FlowTaskEntity flowTaskEntity = flowTaskService.getInfoSubmit(vo.getId());
            if (flowTaskEntity != null) {
                vo.setFlowState(flowTaskEntity.getStatus());
            } else {
                vo.setFlowState(null);
            }
        }
        PageListVO vo = new PageListVO();
        vo.setList(listVO);
        PaginationVO page = JsonUtil.getJsonToBean(zXGL_XiangMuFanKuiPagination, PaginationVO.class);
        vo.setPagination(page);
        return ActionResult.success(vo);
    }


    /**
     * 创建
     *
     * @param zXGL_XiangMuFanKuiCrForm
     * @return
     */
    @ApiOperation("添加项目反馈信息")
    @PostMapping
    @Transactional
    public ActionResult create(@RequestBody @Valid ZXGL_XiangMuFanKuiCrForm zXGL_XiangMuFanKuiCrForm) throws DataException {
        String visualId = "667362571472346309";
        VisualdevEntity visualdevEntity = visualdevService.getInfo(visualId);
        String mainId = RandomUtil.uuId();
        UserInfo userInfo = userProvider.get();

        // reggion 赋值部门领导和负责人
        ZXGL_XiangMuLiXiang_MingXiEntity model = zxglXiangMuLiXiangMingXiService.getInfo(zXGL_XiangMuFanKuiCrForm.getXmid());
        zXGL_XiangMuFanKuiCrForm.setDepartmentManagerZzbm(model.getDepartmentManagerZzbm());
        zXGL_XiangMuFanKuiCrForm.setDepartmentHeadleaderZzbm(model.getDepartmentHeadleaderZzbm());
        // endreion

        // region 赋值主责人是否为部门负责人
        if (StrUtil.isNotEmpty(zXGL_XiangMuFanKuiCrForm.getDepartmentManagerZzbm()) && zXGL_XiangMuFanKuiCrForm.getZrr().equals(zXGL_XiangMuFanKuiCrForm.getDepartmentManagerZzbm())) {
            zXGL_XiangMuFanKuiCrForm.setZzrsfbmfzr("669876724938339973"); // 是
        } else {
            zXGL_XiangMuFanKuiCrForm.setZzrsfbmfzr("669876694466721413"); // 否
        }
        // endregion

        ZXGL_XiangMuFanKuiEntity entity = JsonUtil.getJsonToBean(zXGL_XiangMuFanKuiCrForm, ZXGL_XiangMuFanKuiEntity.class);
        entity.setId(mainId);
        entity.setCreatorTime(new Date());


        zXGL_XiangMuFanKuiService.save(entity);
//        List<ZXGL_XiangMuFanKui_JiaoFuwuEntity> ZXGL_XiangMuFanKui_JiaoFuwuList = JsonUtil.getJsonToList(zXGL_XiangMuFanKuiCrForm.getZxgl_xiangmufankui_jiaofuwuList(), ZXGL_XiangMuFanKui_JiaoFuwuEntity.class);
//        if (ZXGL_XiangMuFanKui_JiaoFuwuList.size()>0){
//            for (ZXGL_XiangMuFanKui_JiaoFuwuEntity entitys : ZXGL_XiangMuFanKui_JiaoFuwuList) {
//                entitys.setId(RandomUtil.uuId());
//                entitys.setMainid(entity.getId());
//                zXGL_XiangMuFanKui_JiaoFuwuService.save(entitys);
//            }
//        }
        if (zXGL_XiangMuFanKuiCrForm.getZxgl_xiangmufankui_renwuList() != null && zXGL_XiangMuFanKuiCrForm.getZxgl_xiangmufankui_renwuList().size() > 0) {
            List<ZXGL_XiangMuFanKui_RenWuEntity> ZXGL_XiangMuFanKui_RenWuList = JsonUtil.getJsonToList(zXGL_XiangMuFanKuiCrForm.getZxgl_xiangmufankui_renwuList(), ZXGL_XiangMuFanKui_RenWuEntity.class);

            for (ZXGL_XiangMuFanKui_RenWuEntity entitys : ZXGL_XiangMuFanKui_RenWuList) {
                entitys.setId(RandomUtil.uuId());
                entitys.setMainid(entity.getId());
                zXGL_XiangMuFanKui_RenWuService.save(entitys);
            }
        }

        if (zXGL_XiangMuFanKuiCrForm.getZxgl_xieBanXiangMuFanKuiMXList() != null && zXGL_XiangMuFanKuiCrForm.getZxgl_xieBanXiangMuFanKuiMXList().size() > 0) {
            List<ZXGL_XieBanXiangMuFanKuiMXEntity> ZXGL_XieBanXiangMuFanKuiMXList = JsonUtil.getJsonToList(zXGL_XiangMuFanKuiCrForm.getZxgl_xieBanXiangMuFanKuiMXList(), ZXGL_XieBanXiangMuFanKuiMXEntity.class);

            for (ZXGL_XieBanXiangMuFanKuiMXEntity entitys : ZXGL_XieBanXiangMuFanKuiMXList) {
                entitys.setId(RandomUtil.uuId());
                entitys.setMainid(entity.getId());

                zxglXieBanXiangMuFanKuiMXService.save(entitys);
            }
        }

        if (FlowStatusEnum.submit.getMessage().equals(zXGL_XiangMuFanKuiCrForm.getStatus())) {
            try {
                VisualUtils.submitFlowTask(visualdevEntity, mainId, zXGL_XiangMuFanKuiCrForm, userInfo, zXGL_XiangMuFanKuiCrForm.getCandidateList());
                FlowTaskEntity flowTaskEntity = flowTaskService.getInfo(mainId);
                if (flowTaskEntity != null) {
                    flowTaskEntity.setTitle(zXGL_XiangMuFanKuiCrForm.getXmmc() + "-项目反馈-" + userInfo.getUserName() + "-" + DateUtil.today());
                    flowTaskEntity.setDataTable("zxgl_xiangmufankui");
                    flowTaskService.update(flowTaskEntity);
                }
            } catch (WorkFlowException e) {
                e.printStackTrace();
            }
            return ActionResult.success("提交成功，请耐心等待");
        }
        return ActionResult.success("保存成功", mainId);
    }


    /**
     * 信息
     *
     * @param id
     * @return
     */
    @ApiOperation("项目反馈信息")
    @GetMapping("/{id}")
    public ActionResult<ZXGL_XiangMuFanKuiInfoVO> info(@PathVariable("id") String id) {
        ZXGL_XiangMuFanKuiEntity entity = zXGL_XiangMuFanKuiService.getInfo(id);
        ZXGL_XiangMuFanKuiInfoVO vo = JsonUtil.getJsonToBean(entity, ZXGL_XiangMuFanKuiInfoVO.class);

        //子表
        List<ZXGL_XiangMuFanKui_JiaoFuwuEntity> ZXGL_XiangMuFanKui_JiaoFuwuList = zXGL_XiangMuFanKuiService.GetZXGL_XiangMuFanKui_JiaoFuwuList(id);
        for (ZXGL_XiangMuFanKui_JiaoFuwuEntity zxgl_xiangmufankui_jiaofuwuEntity : ZXGL_XiangMuFanKui_JiaoFuwuList) {

        }
        vo.setZXGL_XiangMuFanKui_JiaoFuwuList(JsonUtil.getJsonToList(ZXGL_XiangMuFanKui_JiaoFuwuList, ZXGL_XiangMuFanKui_JiaoFuwuModel.class));

        List<ZXGL_XiangMuFanKui_RenWuEntity> ZXGL_XiangMuFanKui_RenWuList = zxglRenWuFanKuiService.getRenWu(entity.getXmid());
        for (ZXGL_XiangMuFanKui_RenWuEntity zxgl_xiangmufankui_renwuEntity : ZXGL_XiangMuFanKui_RenWuList) {

        }
        vo.setZXGL_XiangMuFanKui_RenWuList(JsonUtil.getJsonToList(ZXGL_XiangMuFanKui_RenWuList, ZXGL_XiangMuFanKui_RenWuModel.class));

        List<ZXGL_XieBanXiangMuFanKuiMXEntity> ZXGL_XieBanXiangMuFanKuiMXList = zXGL_XiangMuFanKuiService.GetZXGL_XieBanXiangMuFanKuiMXList(id);
        log.info("ZXGL_XieBanXiangMuFanKuiMXList:=================>" + ZXGL_XieBanXiangMuFanKuiMXList);

        for (ZXGL_XieBanXiangMuFanKuiMXEntity zxgl_xieBanXiangMuFanKuiMXEntity : ZXGL_XieBanXiangMuFanKuiMXList) {

        }
        List<ZXGL_XieBanXiangMuFanKuiMXModel> zXGL_XieBanXiangMuFanKuiMXList = JsonUtil.getJsonToList(ZXGL_XieBanXiangMuFanKuiMXList, ZXGL_XieBanXiangMuFanKuiMXModel.class);
        log.info("zXGL_XieBanXiangMuFanKuiMXList:=================>" + zXGL_XieBanXiangMuFanKuiMXList);
        vo.setZXGL_XieBanXiangMuFanKuiMXList(zXGL_XieBanXiangMuFanKuiMXList);
        //副表
        return ActionResult.success(vo);
    }


    /**
     * 更新
     *
     * @param id
     * @return
     */
    @ApiOperation("修改项目反馈信息")
    @PutMapping("/{id}")
    @Transactional
    public ActionResult update(@PathVariable("id") String id, @RequestBody @Valid ZXGL_XiangMuFanKuiUpForm zXGL_XiangMuFanKuiUpForm) throws DataException {
        String visualId = "667362571472346309";
        VisualdevEntity visualdevEntity = visualdevService.getInfo(visualId);
        UserInfo userInfo = userProvider.get();
        ZXGL_XiangMuFanKuiEntity entity = zXGL_XiangMuFanKuiService.getInfo(id);
        if (entity != null) {

            // reggion 赋值部门领导和负责人
            ZXGL_XiangMuLiXiang_MingXiEntity model = zxglXiangMuLiXiangMingXiService.getInfo(zXGL_XiangMuFanKuiUpForm.getXmid());
            zXGL_XiangMuFanKuiUpForm.setDepartmentManagerZzbm(model.getDepartmentManagerZzbm());
            zXGL_XiangMuFanKuiUpForm.setDepartmentHeadleaderZzbm(model.getDepartmentHeadleaderZzbm());
            // endreion

            // region 赋值主责人是否为部门负责人
            if (StrUtil.isNotEmpty(zXGL_XiangMuFanKuiUpForm.getDepartmentManagerZzbm()) && zXGL_XiangMuFanKuiUpForm.getZrr().equals(zXGL_XiangMuFanKuiUpForm.getDepartmentManagerZzbm())) {
                zXGL_XiangMuFanKuiUpForm.setZzrsfbmfzr("669876724938339973"); // 是
            } else {
                zXGL_XiangMuFanKuiUpForm.setZzrsfbmfzr("669876694466721413"); // 否
            }
            // endregion

            ZXGL_XiangMuFanKuiEntity subentity = JsonUtil.getJsonToBean(zXGL_XiangMuFanKuiUpForm, ZXGL_XiangMuFanKuiEntity.class);

            zXGL_XiangMuFanKuiService.update(id, subentity);

            QueryWrapper<ZXGL_XiangMuFanKui_JiaoFuwuEntity> ZXGL_XiangMuFanKui_JiaoFuwuqueryWrapper = new QueryWrapper<>();
            ZXGL_XiangMuFanKui_JiaoFuwuqueryWrapper.lambda().eq(ZXGL_XiangMuFanKui_JiaoFuwuEntity::getMainid, entity.getId());
            zXGL_XiangMuFanKui_JiaoFuwuService.remove(ZXGL_XiangMuFanKui_JiaoFuwuqueryWrapper);

            if (zXGL_XiangMuFanKuiUpForm.getZxgl_xiangmufankui_jiaofuwuList() != null && zXGL_XiangMuFanKuiUpForm.getZxgl_xiangmufankui_jiaofuwuList().size() > 0) {
                List<ZXGL_XiangMuFanKui_JiaoFuwuEntity> ZXGL_XiangMuFanKui_JiaoFuwuList = JsonUtil.getJsonToList(zXGL_XiangMuFanKuiUpForm.getZxgl_xiangmufankui_jiaofuwuList(), ZXGL_XiangMuFanKui_JiaoFuwuEntity.class);
                for (ZXGL_XiangMuFanKui_JiaoFuwuEntity entitys : ZXGL_XiangMuFanKui_JiaoFuwuList) {
                    entitys.setId(RandomUtil.uuId());
                    entitys.setMainid(entity.getId());
                    zXGL_XiangMuFanKui_JiaoFuwuService.save(entitys);
                }
            }


            QueryWrapper<ZXGL_XiangMuFanKui_RenWuEntity> ZXGL_XiangMuFanKui_RenWuqueryWrapper = new QueryWrapper<>();
            ZXGL_XiangMuFanKui_RenWuqueryWrapper.lambda().eq(ZXGL_XiangMuFanKui_RenWuEntity::getMainid, entity.getId());
            zXGL_XiangMuFanKui_RenWuService.remove(ZXGL_XiangMuFanKui_RenWuqueryWrapper);

            if (zXGL_XiangMuFanKuiUpForm.getZxgl_xiangmufankui_renwuList() != null && zXGL_XiangMuFanKuiUpForm.getZxgl_xiangmufankui_renwuList().size() > 0) {
                List<ZXGL_XiangMuFanKui_RenWuEntity> ZXGL_XiangMuFanKui_RenWuList = JsonUtil.getJsonToList(zXGL_XiangMuFanKuiUpForm.getZxgl_xiangmufankui_renwuList(), ZXGL_XiangMuFanKui_RenWuEntity.class);
                for (ZXGL_XiangMuFanKui_RenWuEntity entitys : ZXGL_XiangMuFanKui_RenWuList) {
                    entitys.setId(RandomUtil.uuId());
                    entitys.setMainid(entity.getId());
                    zXGL_XiangMuFanKui_RenWuService.save(entitys);
                }
            }

            QueryWrapper<ZXGL_XieBanXiangMuFanKuiMXEntity> zxgl_xieBanXiangMuFanKuiMXEntityQueryWrapper = new QueryWrapper<>();
            zxgl_xieBanXiangMuFanKuiMXEntityQueryWrapper.lambda().eq(ZXGL_XieBanXiangMuFanKuiMXEntity::getMainid, entity.getId());
            zxglXieBanXiangMuFanKuiMXService.remove(zxgl_xieBanXiangMuFanKuiMXEntityQueryWrapper);

            if (zXGL_XiangMuFanKuiUpForm.getZxgl_xieBanXiangMuFanKuiMXList() != null && zXGL_XiangMuFanKuiUpForm.getZxgl_xieBanXiangMuFanKuiMXList().size() > 0) {
                List<ZXGL_XieBanXiangMuFanKuiMXEntity> ZXGL_XieBanXiangMuFanKuiMXList = JsonUtil.getJsonToList(zXGL_XiangMuFanKuiUpForm.getZxgl_xieBanXiangMuFanKuiMXList(), ZXGL_XieBanXiangMuFanKuiMXEntity.class);

                for (ZXGL_XieBanXiangMuFanKuiMXEntity entitys : ZXGL_XieBanXiangMuFanKuiMXList) {
                    entitys.setId(RandomUtil.uuId());
                    entitys.setMainid(entity.getId());
                    zxglXieBanXiangMuFanKuiMXService.save(entitys);
                }
            }


            if (FlowStatusEnum.submit.getMessage().equals(zXGL_XiangMuFanKuiUpForm.getStatus())) {
                try {
                    VisualUtils.submitFlowTask(visualdevEntity, id, subentity, userInfo, zXGL_XiangMuFanKuiUpForm.getCandidateList());
                    FlowTaskEntity flowTaskEntity = flowTaskService.getInfo(id);
                    if (flowTaskEntity != null) {
                        flowTaskEntity.setTitle(zXGL_XiangMuFanKuiUpForm.getXmmc() + "-项目反馈-" + userInfo.getUserName() + "-" + DateUtil.today());
                        flowTaskEntity.setDataTable("zxgl_xiangmufankui");
                        flowTaskService.update(flowTaskEntity);
                    }
                } catch (WorkFlowException e) {
                    e.printStackTrace();
                }
                return ActionResult.success("提交成功，请耐心等待");
            }
            return ActionResult.success("更新成功");
        } else {
            return ActionResult.fail("更新失败，数据不存在");
        }
    }

    /**
     * 删除
     *
     * @param id
     * @return
     */
    @ApiOperation("删除项目反馈信息")
    @DeleteMapping("/{id}")
    @Transactional
    public ActionResult delete(@PathVariable("id") String id) {
        ZXGL_XiangMuFanKuiEntity entity = zXGL_XiangMuFanKuiService.getInfo(id);
        if (entity != null) {
            FlowTaskEntity taskEntity = flowTaskService.getInfoSubmit(id);
            if (taskEntity != null) {
                try {
                    flowTaskService.delete(taskEntity);
                } catch (WorkFlowException e) {
                    e.printStackTrace();
                }
            }
            zXGL_XiangMuFanKuiService.delete(entity);
            QueryWrapper<ZXGL_XiangMuFanKui_JiaoFuwuEntity> queryWrapperZXGL_XiangMuFanKui_JiaoFuwu = new QueryWrapper<>();
            queryWrapperZXGL_XiangMuFanKui_JiaoFuwu.lambda().eq(ZXGL_XiangMuFanKui_JiaoFuwuEntity::getMainid, entity.getId());
            zXGL_XiangMuFanKui_JiaoFuwuService.remove(queryWrapperZXGL_XiangMuFanKui_JiaoFuwu);
            QueryWrapper<ZXGL_XiangMuFanKui_RenWuEntity> queryWrapperZXGL_XiangMuFanKui_RenWu = new QueryWrapper<>();
            queryWrapperZXGL_XiangMuFanKui_RenWu.lambda().eq(ZXGL_XiangMuFanKui_RenWuEntity::getMainid, entity.getId());
            zXGL_XiangMuFanKui_RenWuService.remove(queryWrapperZXGL_XiangMuFanKui_RenWu);

        }
        return ActionResult.success("删除成功");
    }

    /***
     * 新增AI评分评价
     * @param zxglXiangMuFanKuiEntity
     * @return
     */
    @ApiOperation("新增AI评分评价")
    @PostMapping("/addAiPf")
    @Transactional
    public boolean addAiPf(@RequestBody ZXGL_XiangMuFanKuiEntity zxglXiangMuFanKuiEntity) {
        return zXGL_XiangMuFanKuiService.addAiPf(zxglXiangMuFanKuiEntity);
    }

    /***
     *项目反馈完成后，更新项目底表
     * @param zxglXiangMuFanKuiInfoVO
     * @return
     */
    @PostMapping("/updateProjectdetail")
    @Transactional
    public Boolean updateProjectdetail(@RequestBody ZXGL_XiangMuFanKuiInfoVO zxglXiangMuFanKuiInfoVO) {
        return zXGL_XiangMuFanKuiService.updateProjectdetail(zxglXiangMuFanKuiInfoVO);
    }

    @GetMapping("/getProjectFk/{id}")
    @Transactional
    public ActionResult getProjectFk(@PathVariable("id") String id) {
        return ActionResult.success(zXGL_XiangMuFanKuiService.addProjectFk(id));
    }

    /***
     * 项目反馈AI回调接口
     * @param zxglAiResponsibilityCallBack
     * @return
     * @throws DataException
     */
    @PostMapping("/allocateXmkuiCallBack")
    @Transactional
    public ActionResult allocateXmkuiCallBack(@RequestBody ZXGL_AI_xmfk_CallBack zxglAiResponsibilityCallBack) throws DataException {
        log.info("allocateResponsibilityCallback----------------------------》回调已经成功");
//        ZXGL_XMCFZGBMJS_MingXiEntity entity = zXGL_XMCFZGBMJS_MingXiService.getById(zxglAiResponsibilityCallBack.getFlowId());
//        if (entity != null) {
//            entity.setQtry(zxglAiResponsibilityCallBack.getReturnJson().getLeadPersonnel().getId());
//            entity.setZrr(zxglAiResponsibilityCallBack.getReturnJson().getProjectManagers().getId());
//            entity.setXzr(zxglAiResponsibilityCallBack.getReturnJson().getCollaborators().getId());
//            zXGL_XMCFZGBMJS_MingXiService.updateById(entity);
//            return ActionResult.success("更新成功");
//        }
        return ActionResult.fail("更新失败，数据不存在");
    }

    /***
     * 更新sftj状态
     * @param zxglRenWuFanKuiInfoVO
     * @return
     */
    @PostMapping("/updateSftjByIdOne")
    @Transactional
    public Boolean updateSftjByIdOne(@RequestBody ZXGL_RenWuFanKuiInfoVO zxglRenWuFanKuiInfoVO) {
        ZXGL_XiangMuFanKuiEntity zxglXiangMuFanKui = new ZXGL_XiangMuFanKuiEntity();
        zxglXiangMuFanKui.setId(zxglRenWuFanKuiInfoVO.getTaskId());
        zxglXiangMuFanKui.setSftj(1);
        return zXGL_XiangMuFanKuiService.updateById(zxglXiangMuFanKui);
    }

    /***
     * 更新sftj状态
     * @param zxglRenWuFanKuiInfoVO
     * @return
     */
    @PostMapping("/updateSftjById")
    @Transactional
    public Boolean updateSftjById(@RequestBody ZXGL_RenWuFanKuiInfoVO zxglRenWuFanKuiInfoVO) {
        ZXGL_XiangMuFanKuiEntity zxglXiangMuFanKui = new ZXGL_XiangMuFanKuiEntity();
        zxglXiangMuFanKui.setId(zxglRenWuFanKuiInfoVO.getTaskId());
        zxglXiangMuFanKui.setSftj(0);
        return zXGL_XiangMuFanKuiService.updateById(zxglXiangMuFanKui);
    }
}
